<?php
/**
 * Create account form template
 *
 * @see app/design/frontend/base/default/template/customer/form/register.phtml
 */
/** @var $this Mage_Customer_Block_Form_Register */
?>
<div class="account-create">
    <div class="page-title">
        <h1><?php echo $this->__('Create an Account') ?></h1>
    </div>
    <?php echo $this->getChildHtml('form_fields_before')?>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
        <div class="block block-personal-info">
            <div class="block-title">
                <strong><span><?php echo $this->__('Personal Information') ?></span></strong>
            </div>
            <div class="block-content">
                <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
                <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
                <ul class="form-list">
                    <li class="fields">
                        <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
                    </li>
                    <li class="wide">
                        <div class="input-box">
                            <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" placeholder="<?php echo $this->__('Email Address') ?> *"/>
                        </div>
                    </li>
                    <?php if ($this->isNewsletterEnabled()): ?>
                    <li class="control">
                        <div class="input-box">
                            <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
                        </div>
                        <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
                    </li>
                    <?php endif ?>
                <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
                <?php if ($_dob->isEnabled()): ?>
                    <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
                <?php endif ?>
                <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
                <?php if ($_taxvat->isEnabled()): ?>
                    <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
                <?php endif ?>
                <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
                <?php if ($_gender->isEnabled()): ?>
                    <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
                <?php endif ?>
                </ul>
            </div>
        </div>
    <?php if($this->getShowAddressFields()): ?>
        <div class="block block-address-info">
            <div class="block-title">
                <strong><span><?php echo $this->__('Address Information') ?></span></strong>
            </div>
            <div class="block-content">
                <input type="hidden" name="create_address" value="1" />
                <ul class="form-list">
                    <li class="fields">
                        <div class="field">
                            <div class="input-box">
                                <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" placeholder="<?php echo $this->__('Company') ?>" />
                            </div>
                        </div>
                        <div class="field">
                            <div class="input-box">
                                <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" placeholder="<?php echo $this->__('Telephone') ?> *" />
                            </div>
                        </div>
                    </li>
                <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
                    <li class="wide">
                        <div class="input-box">
                            <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" placeholder="<?php echo $this->__('Street Address') ?> *"/>
                        </div>
                    </li>
                <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
                <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
                    <li class="wide">
                        <div class="input-box">
                            <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" placeholder="<?php echo $this->__('Street Address').$_i ?>"/>
                        </div>
                    </li>
                <?php endfor; ?>
                    <li class="fields">
                        <div class="field">
                            <div class="input-box">
                                <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" placeholder="<?php echo $this->__('City') ?> *"/>
                            </div>
                        </div>
                        <div class="field">
                            <div class="input-box">
                                <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
                                    <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
                                </select>
                                <script type="text/javascript">
                                //<![CDATA[
                                    $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
                                //]]>
                                </script>
                                <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" placeholder="<?php echo $this->__('State/Province') ?> *"/>
                            </div>
                        </div>
                    </li>
                    <li class="fields">
                        <div class="field">
                            <div class="input-box">
                                <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" placeholder="<?php echo $this->__('Zip/Postal Code') ?> *"/>
                            </div>
                        </div>
                        <div class="field">
                            <div class="input-box">
                                <?php echo $this->getCountryHtmlSelect() ?>
                            </div>
                        </div>
                    </li>
                </ul>
                <input type="hidden" name="default_billing" value="1" />
                <input type="hidden" name="default_shipping" value="1" />
            </div>
        </div>
    <?php endif; ?>
        <div class="block block-login-info">
            <div class="block-title">
                <strong><span><?php echo $this->__('Login Information') ?></span></strong>
            </div>
            <div class="block-content">
                <ul class="form-list">
                    <li class="fields">
                        <div class="field">
                            <div class="input-box">
                                <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" placeholder="<?php echo $this->__('Password') ?> *"/>
                            </div>
                        </div>
                        <div class="field">
                            <div class="input-box">
                                <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" placeholder="<?php echo $this->__('Confirm Password') ?> *"/>
                            </div>
                        </div>
                    </li>
                    <?php echo $this->getChildHtml('form.additional.info'); ?>
                    <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                </ul>
                <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
            </div>
        </div>
        <div class="buttons-set">
            <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
            <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
        </div>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif; ?>
    </form>
    <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('form-validate', true);
        <?php if($this->getShowAddressFields()): ?>
        new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
        <?php endif; ?>
    //]]>
    </script>
</div>
